'use strict';
Object.defineProperties(exports, {
  __esModule: { value: !0 },
  [Symbol.toStringTag]: { value: 'Module' },
});
const c = require('./stringify.cjs'),
  b = require('./parse.cjs');
function s(r) {
  r = decodeURIComponent(encodeURIComponent(r));
  const o = [];
  for (let n = 0; n < r.length; ++n) o.push(r.charCodeAt(n));
  return o;
}
const l = '6ba7b810-9dad-11d1-80b4-00c04fd430c8',
  y = '6ba7b811-9dad-11d1-80b4-00c04fd430c8';
function h(r, o, n) {
  function d(i, e, f, g) {
    if (
      (typeof i == 'string' && (i = s(i)),
      typeof e == 'string' && (e = b.default(e)),
      (e == null ? void 0 : e.length) !== 16)
    )
      throw TypeError(
        'Namespace must be array-like (16 iterable integer values, 0-255)',
      );
    let t = new Uint8Array(16 + i.length);
    if (
      (t.set(e),
      t.set(i, e.length),
      (t = n(t)),
      (t[6] = (t[6] & 15) | o),
      (t[8] = (t[8] & 63) | 128),
      f)
    ) {
      g = g || 0;
      for (let u = 0; u < 16; ++u) f[g + u] = t[u];
      return f;
    }
    return c.unsafeStringify(t);
  }
  try {
    d.name = r;
  } catch {}
  return (d.DNS = l), (d.URL = y), d;
}
exports.DNS = l;
exports.URL = y;
exports.default = h;
